TOPE = 1000

def CrearDiccionario():
	d = dict()
	d[1] = 'one'
	d[2] = 'two'
	d[3] = 'three'
	d[4] = 'four'
	d[5] = 'five'
	d[6] = 'six'
	d[7] = 'seven'
	d[8] = 'eight'
	d[9] = 'nine'
	d[10] = 'ten'
	d[11] = 'eleven'
	d[12] = 'twelve'
	d[13] = 'thirteen'
	d[14] = 'fourteen'
	d[15] = 'fifteen'
	d[16] = 'sixteen'
	d[17] = 'seventeen'
	d[18] = 'eighteen'
	d[19] = 'nineteen'
	d[20] = 'twenty'
	d[30] = 'thirty'
	d[40] = 'forty'
	d[50] = 'fifty'
	d[60] = 'sixty'
	d[70] = 'seventy'
	d[80] = 'eighty'
	d[90] = 'ninety'
	d[100] = 'hundred'
	d[1000] = 'thousand'
	return d

def Convertir(d, n):
	if n <= 20 or (n < 100 and n % 10 == 0):
		return d[n]
	elif n < 100:
		s = str(n)
		d1 = int(s[0]+'0')
		d2 = int(s[1])
		if d2 == 0:
			return d[d1]
		else:
			return d[d1]+d[d2]
	elif n < 1000:
		s = str(n)
		d1 = int(s[0])
		d2 = int(s[1]+'0')
		d3 = int(s[2])
		s = 'and'
		if d2 != 0:
			s += d[d2]
		if d3 != 0:
			s += d[d3]
		if (len(s) == 3):
			s = ''
		return d[d1]+d[100]+s
	else:
		return d[1]+d[1000]
	return ''	

if __name__ == '__main__':
	import os
	os.system('cls')
	
	d = CrearDiccionario()
	cantidad = 0
	for x in range(1, TOPE+1):
		s = Convertir(d, x)
		print s
		cantidad += len(s)

	print '\n\t', cantidad, '\n' 
